﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;

namespace ZuesControls.Converters
{
    public class PressedThicknessConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length < 2 || values[0] == DependencyProperty.UnsetValue || values[1] == DependencyProperty.UnsetValue)
                return new Thickness(1);

            bool isPressed = values[0] is bool pressed && pressed;
            Thickness baseThickness = values[1] is Thickness t ? t : new Thickness(1);

            if (isPressed)
            {
                return new Thickness(baseThickness.Left * 1.5, baseThickness.Top * 1.5, baseThickness.Right * 1.5, baseThickness.Bottom * 1.5);
            }
            return baseThickness;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
